package eerr.llrr.oorr.pte9983.b.wifimaster.splash.module;

import static yyee.llee.mmee.base_api_factory.ModuleConfig.AD_LOG_TAG;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.app.AppCompatActivity;
import com.bykv.vk.openvk.TTSphObject;
import com.bykv.vk.openvk.TTVfNative;
import com.bykv.vk.openvk.TTVfSdk;
import com.bykv.vk.openvk.VfSlot;
import yyee.llee.mmee.ad_tj.ADTJ;
import yyee.llee.mmee.base_api_net.base_api_bean.NATAdInfo;
import bi.GL;
import yyee.llee.mmee.common.global.Env;
import yyee.llee.mmee.pl190.host668.ScreenUtils;
import com.tencent.mmkv.MMKV;
import com.manager.core.ad.single.TTSdk;
import com.manager.core.master.scope.AdParams;
import com.manager.core.master.view.AutoConfigAdViewScope;
import com.manager.core.master.view.ScopeFinishListener;
import java.lang.ref.WeakReference;
import java.util.UUID;
import timber.log.Timber;

public class FirstSplashAdFixTimeOut {

    public static boolean isFisrtLoad() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        return MMKV.defaultMMKV().decodeBool("splash:setfisrtload", true);
    }

    public static void setFisrtLoad() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        MMKV.defaultMMKV().encode("splash:setfisrtload", false);
    }

    public void loadSplash(AppCompatActivity activity, ViewGroup adContenaer, OnFixSplashListener onFixSplashListener) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        if (isFisrtLoad() && activity != null) {
            TTSdk.init();
            // 创建TTAdNative对象，createAdNative(Context context) context需要传入Activity对象
            TTVfNative mTTAdNative = TTVfSdk.getVfManager().createVfNative(activity);
            Timber.tag("third-sdk").d("TTAdSdk FISRT_SPLASH  = " + Env.FISRT_SPLASH);
            VfSlot adSlot = new VfSlot.Builder().setCodeId(Env.FISRT_SPLASH).setExpressViewAcceptedSize(ScreenUtils.getScreenWidth(activity), ScreenUtils.getScreenHeight(activity)).build();
            final String uuid = UUID.randomUUID().toString();
            ADTJ.onAdReq(uuid, "splash", null);
            mTTAdNative.loadSphVs(adSlot, new TTVfNative.SphVfListener() {

                @Override
                public void onError(int i, String s) {
                    int passwordfdare32432qresafdsagda32 = 123456;
                    int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
                    int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
                    for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
                        int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
                        for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                            if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                                minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                            }
                        }
                        if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                            int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                            arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                            arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
                        }
                    }
                    GL.d(AD_LOG_TAG, "首次开屏广告load onError() i = [" + i + "], s = [" + s + "]");
                    if (onFixSplashListener != null) {
                        onFixSplashListener.finish();
                    }
                }

                @Override
                public void onTimeout() {
                    int passwordfdare32432qresafdsagda32 = 123456;
                    int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
                    int keydasopuerqnfdazcveq = 4;
                    int lowupoeqfda7073fdal = 0;
                    int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
                    int middledaiueprnvznfewqip = 0;
                    if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
                        int adfajpouqregjbdipug = 1;
                    } else {
                        while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                            middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                            if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                                // 比关键字大则关键字在左区域
                                highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                            } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                                // 比关键字小则关键字在右区域
                                lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                            } else {
                            }
                        }
                    }
                    GL.d(AD_LOG_TAG, "首次开屏广告load  onTimeout() called");
                    if (onFixSplashListener != null) {
                        onFixSplashListener.finish();
                    }
                }

                @Override
                public void onSphVsLoad(TTSphObject ttSplashAd) {
                    int passwordfdare32432qresafdsagda32 = 123456;
                    int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
                    for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
                        int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
                        while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                            jfdsaipureqwrewq7843791298047ui--;
                        }
                        arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
                    }
                    final String uuid = UUID.randomUUID().toString();
                    ADTJ.onAdFull(uuid, "splash", null);
                    GL.d(AD_LOG_TAG, "首次开屏广告load 成功" + ttSplashAd);
                    if (ttSplashAd != null) {
                        ttSplashAd.setSplashInteractionListener(new TTSphObject.VfInteractionListener() {

                            @Override
                            public void onClicked(View view, int i) {
                            }

                            @Override
                            public void onShow(View view, int i) {
                                int passwordfdare32432qresafdsagda32 = 123456;
                                int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
                                for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
                                    int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
                                    while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                                        arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                                        jfdsaipureqwrewq7843791298047ui--;
                                    }
                                    arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
                                }
                                GL.d(AD_LOG_TAG, "首次开屏广告Show");
                                ADTJ.onAdShow(uuid, "splash", new NATAdInfo("", Env.FISRT_SPLASH, "", 0));
                            }

                            @Override
                            public void onSkip() {
                                int passwordfdare32432qresafdsagda32 = 123456;
                                int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
                                for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
                                    for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                                        if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                                            int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                                            numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                                            numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                                        }
                                    }
                                }
                                if (onFixSplashListener != null) {
                                    onFixSplashListener.finish();
                                }
                            }

                            @Override
                            public void onTimeOver() {
                                int passwordfdare32432qresafdsagda32 = 123456;
                                int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
                                for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
                                    for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                                        if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                                            int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                                            numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                                            numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                                        }
                                    }
                                }
                                if (onFixSplashListener != null) {
                                    onFixSplashListener.finish();
                                }
                            }
                        });
                        View splashView = ttSplashAd.getSplashView();
                        if (splashView != null) {
                            adContenaer.removeView(splashView);
                            adContenaer.addView(splashView);
                            return;
                        }
                    }
                    if (onFixSplashListener != null) {
                        onFixSplashListener.finish();
                    }
                }
            }, 5000);
            if (adContenaer != null) {
                adContenaer.setVisibility(View.VISIBLE);
            }
            setFisrtLoad();
        } else {
            if (activity == null) {
                if (onFixSplashListener != null) {
                    onFixSplashListener.finish();
                }
                return;
            }
            AutoConfigAdViewScope autoConfigAdViewScope = new AutoConfigAdViewScope();
            AdParams AdParams = new AdParams();
            AdParams.setActivity(new WeakReference<>(activity));
            AdParams.setAdkey("in_splash");
            AdParams.setContinaer(new WeakReference<>(adContenaer));
            autoConfigAdViewScope.show(AdParams, new ScopeFinishListener() {

                @Override
                public void showLoading() {
                }

                @Override
                public void hideLoading() {
                }

                @Override
                public void onComplete() {
                    int passwordfdare32432qresafdsagda32 = 123456;
                    int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
                    for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
                        for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                            if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                                int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                                numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                                numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                            }
                        }
                    }
                    if (onFixSplashListener != null) {
                        onFixSplashListener.finish();
                    }
                }

                @Override
                public void toNextAndFinish() {
                }
            });
            activity.getLifecycle().addObserver(autoConfigAdViewScope);
        }
    }

    public interface OnFixSplashListener {

        void finish();
    }
}
